home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Inventor Labs: Technology
/
INVENTORLABS_TECHNOLOGY.BIN
/
pc
/
files
/
invest.dir
/
00003_Script_Inv Lens Obj
< prev
next >
Wrap
Text File
|
1997-05-26
|
11KB
|
375 lines
--Inv Lens Object Script
property pStartLensSpriteNum, pStartLensCastNum, pStartTopMOVCastNum
property pDiagramSpriteNum, pLensPos, pObjectPos, pLens
property pLensList1, pLensList2, pLastObjectPos, pMember
property pLastLensPos, pDiagramStartCast, pPuppetSpriteList
---------------------------------------------------------------ò
on mInit me
set pStartLensSpriteNum = 14
set pStartLensCastNum = the number of cast "ILEL1SP.PIC"
set pStartTopMOVCastNum = the number of cast "ILECVX.mov"
set pDiagramSpriteNum = 18
set pDiagramStartCast = (the number of cast "ILECV121.8bt") - 1
set pPuppetSpriteList = [4,5,8,9,12,18]
mActivate( me )
return( me )
end mInit
---------------------------------------------------------------ò
on mActivate me
repeat with spritenum in pPuppetSpriteList
puppetSprite spritenum, true
end repeat
-- set the castnum of sprite 12 = 95
-- set the rect of sprite 12 = the rect of sprite 13
-- updatestage
set the movieTime of sprite 12 = 236
updatestage
set the rect of sprite 12 = the rect of sprite 13
-- set the locH of sprite 12 = the locH of sprite 13
-- set the locV of sprite 12 = the locV of sprite 13
-- updateStage
--
-- updateStage
set the visible of sprite 12 = 1
set the visible of sprite 18 to false
-- create list of start frames for lens movie
set pLensList1 = list(25)
set pLensList2 = list(25)
-- initialize values for lens list
mInitLensList(me)
-- initialize lens and object positions
set pLensPos to 1
set pObjectPos to 6
set pLastObjectPos to 6
set pLastLensPos to 1
set pLens = 1
end mActivate
---------------------------------------------------------------ò
on mClose me
repeat with x in pPuppetSpriteList
puppetSprite x, false
end repeat
set the visible of sprite 18 to true
puppetsprite 33, false
--tj&dl
repeat with n = 2 to 20
set the puppet of sprite n = 0
set the visible of sprite n = 1
end repeat
end mClose
---------------------------------------------------------------ò
on mClickLens me
set pMember = the clickOn
-- remember last position
--set lastLensPos to (1+((the loch of sprite 9 - 305)/60))
-- move the lens with the cursor
repeat while the mouseDown
put the mouseh into tempx
if tempx < 305 then
set tempx = 305
end if
if tempx > 605 then
set tempx = 605
end if
set the loch of sprite 5 to tempx
updateStage
end repeat
-- calculate the slider position (add in 30 to round off properly)
set pLensPos = 1+(tempx-275)/60
-- check to see if position is free
mCheckClash(me)
put "Lens"&&pLensPos&&pObjectPos&&pLastLensPos
-- determine closest position
set snapPos = 60*(pLensPos-1)+305
-- snap lens to set position
set the loch of sprite 5 to snapPos
-- move lens from last position to chosen position
mMoveLens(me)
updateStage
end mClickLens
---------------------------------------------------------------ò
on mTopClick me
-- remember last position
--set pLastObjectPos to (((the loch of sprite 8 - 305)/60)+1)
set pMember = the clickOn
repeat while the mousedown
put the mouseh into tempx2
if tempx2 < 305 then
set tempx2 = 305
end if
if tempx2 > 605 then
set tempx2 = 605
end if
set the loch of sprite 4 to tempx2
updateStage
end repeat
-- calculate the slider position
set pObjectPos = 1+(tempx2-275)/60
-- check to see if position is free
mCheckClash(me)
set snapPos = 60*(pObjectPos-1)+305
set the locH of sprite 4 to snapPos
-- move object from last position to chosen position
mMoveObject(me)
updateStage
end mTopClick
---------------------------------------------------------------ò
on mCheckClash me
if pMember = 9 then
if pLensPos >= pObjectPos then
set pLensPos to pLastLensPos
end if
else
if pLensPos >= pObjectPos then
set pObjectPos to pLastObjectPos
end if
end if
end mCheckClash
---------------------------------------------------------------ò
on mMoveLens me
put "Lens"&&pLensPos&&pLastLensPos
set endPos = pLensPos
if endPos < pLastLensPos then
set direction = -1
else
set direction = 1
end if
-- determine the movie start and end frames for the move
-- list values are the positions in the frame matrix
set listvalue1 = (pObjectPos-2)*5+pLastLensPos
set listvalue2 = (pObjectPos-2)*5+pLensPos
-- add offset of 604 ticks to access lens movement part of movie
if listvalue1 > count(pLensList2) then set listvalue1 = count(pLensList2)
if listvalue1 < 1 then set listvalue1 = 1
set startFrame = getAt(pLensList2,listvalue1)
if listvalue2 > count(pLensList2) then set listvalue2 = count(pLensList2)
if listvalue2 < 1 then set listvalue2 = 1
set endFrame = getAt(pLensList2,listvalue2)
set xx = StartFrame
put "move lens"&&pLensPos&&pObjectPos&&startFrame&&endFrame
if endFrame < startFrame then
repeat while xx > endFrame
set the movietime of sprite 12 to xx
set the loch of sprite 9 to the loch of sprite 9 + direction*4
updateStage
set xx = xx + direction*4
end repeat
else
repeat while xx < endFrame
set the movietime of sprite 12 to xx
set the loch of sprite 9 to the loch of sprite 9 + direction*4
updateStage
set xx = xx + direction*4
end repeat
end if
put "last test"&&pLastLensPos&&endpos
set pLastLensPos = endpos
put "last test2 "&&pLastLensPos&&endpos
end mMoveLens
---------------------------------------------------------------ò
on mMoveObject me
set endPos = pObjectPos
if endPos < pLastObjectPos then
set direction = -1
else
set direction = 1
end if
-- determine the movie start and end frames for the move
-- list values are the positions in the frame matrix
set listvalue1 = (pLastObjectPos-2)*5+pLensPos
set listvalue2 = (endPos-2)*5+pLensPos
set startFrame = getAt(pLensList1,listvalue1)
set endFrame = getAt(pLensList1,listvalue2)
put startFrame&&endframe
set xx = StartFrame
if endFrame < startFrame then
repeat while xx > endFrame
set the movietime of sprite 12 to xx
set the loch of sprite 8 to the loch of sprite 8 + direction*4
updateStage
set xx = xx + direction*4
end repeat
else
repeat while xx < endFrame
set the movietime of sprite 12 to xx
set the loch of sprite 8 to the loch of sprite 8 + direction*4
updateStage
set xx = xx + direction*4
end repeat
end if
-- correction for slight offset
--set the loch of sprite 8 to the loch of sprite 8 - 2
set pLastObjectPos = endpos
end mMoveObject
---------------------------------------------------------------ò
on mInitLensList me
-- this script puts values into the list Lenslist, which contains
-- the frame numbers in the movie "lens composite" for various lens and
-- object positions. Internally, these lists are 5x5 grids (pObjectPos,pLensPos)
-- there are two lists, pLensList1, and pLensList2
-- pLensList1 holds the frame numbers for the animations in which the object
-- is moving
-- pLensList2 holds the frame numbers for the animations in which the lens
-- is moving.
-- all the animations are contained in the "lens composite" movie to eliminate
-- flashing (when switching movies)
-- initialize pLensList1
setAt(pLensList1,1,0)
setAt(pLensList1,6,56)
setAt(pLensList1,7,240)
setAt(pLensList1,11,116)
setAt(pLensList1,12,296)
setAt(pLensList1,13,420)
setAt(pLensList1,16,176)
setAt(pLensList1,17,356)
setAt(pLensList1,18,476)
setAt(pLensList1,19,540)
setAt(pLensList1,21,236)
setAt(pLensList1,22,416)
setAt(pLensList1,23,536)
setAt(pLensList1,24,596)
setAt(pLensList1,25,600)
-- initialize pLensList2
setAt(pLensList2,1,604)
setAt(pLensList2,6,608)
setAt(pLensList2,7,664)
setAt(pLensList2,11,668)
setAt(pLensList2,12,724)
setAt(pLensList2,13,784)
setAt(pLensList2,16,788)
setAt(pLensList2,17,844)
setAt(pLensList2,18,904)
setAt(pLensList2,19,964)
setAt(pLensList2,21,968)
setAt(pLensList2,22,1024)
setAt(pLensList2,23,1084)
setAt(pLensList2,24,1144)
setAt(pLensList2,25,1204)
end mInitLensList
---------------------------------------------------------------ò
on mResetTrack me
set the loch of sprite 8 to (pObjectPos-1)*60+305
set the loch of sprite 9 to (pLensPos-1)*60+305
set the loch of sprite 4 to the loch of Sprite 8
set the loch of sprite 5 to the loch of sprite 9
updateStage
end mResetTrack
---------------------------------------------------------------ò
on mLensClickEvent me, aTopQTcastIndex, aLensNum
--aTopQTcastIndex is 0 or 1
--aLensNum is 1, 2, 3, or 4
set LensIndex = the clickon - pStartLensSpriteNum
global pLensPos,pObjectPos,pLastLensPos,pLastObjectPos
set the castnum of sprite 9 to pStartLensCastNum + LensIndex
set the castnum of sprite 5 to pStartLensCastNum + LensIndex + 4
set the castnum of sprite 12 to pStartTopMOVCastNum + aTopQTcastIndex
set pLensPos = 1
set pObjectPos = 6
set pLastLensPos = 1
set pLastObjectPos = 6
set pLens = aLensNum
mResetTrack(me)
end mLensClickEvent
---------------------------------------------------------------ò
on mLeftButtonPress me
set the visible of sprite pDiagramSpriteNum = false
updateStage
end mLeftButtonPress
---------------------------------------------------------------ò
on mRightButtonPress me
set temp = (pLens-1)*15+pDiagramStartCast--\
put temp + pObjectPos-1
if pLensPos = 1 then
set the castnum of sprite pDiagramSpriteNum to temp + pObjectPos-1
end if
if pLensPos = 2 then
set the castnum of sprite pDiagramSpriteNum to temp + 5 + pObjectPos-2
end if
if pLensPos = 3 then
set the castnum of sprite pDiagramSpriteNum to temp + 9 + pObjectPos-3
end if
if pLensPos = 4 then
set the castnum of sprite pDiagramSpriteNum to temp + 12 + pObjectPos-4
end if
if pLensPos = 5 then
set the castnum of sprite pDiagramSpriteNum to temp + 14 + pObjectPos-5
end if
set the visible of sprite pDiagramSpriteNum to true
updateStage
end mRightButtonPress
---------------------------------------------------------------ò